<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<script type="text/javascript" src="js/jquery.itextclear.js"></script>
<script type="text/javascript">
	$(document)
			.ready(
					function() {
						$(
								'input[type=text], input[type=password], input[type=url], input[type=email], input[type=number], textarea',
								'.form').iTextClear();
					});
</script>
<!-- jQplot CSS -->

<link rel="stylesheet" media="screen" href="${ctx}/css/Tree.css" />
<!-- jQplot CSS END -->

<!-- DATATABLES CSS -->
<link rel="stylesheet" media="screen" href="lib/datatables/css/vpad.css" />
<script type="text/javascript"
	src="lib/datatables/js/jquery.dataTables.js"></script>
<!-- DATATABLES CSS END -->

<h1 class="page-title">招聘渠道 - ${listTitle}</h1>
<div class="container_12 clearfix leading">
	<div class="side grid_12 leading">
		<form class="form has-validation" id="post_form">
            <input type="hidden" name="operation" value="${operation}" />
            <input type="hidden" name="ids" value="${ids}"/>
			<div class="clear"></div>
			<div class="clearfix">
				<label class="form-label">招聘渠道</label>
				<div class="form-input">
					<%--<input type="text" name="inviteFashion.channel" id="channel" />--%>
                    <select name="inviteFashion.channel" id="channel">
                        <option value="site">现场</option>
                        <option value="network">网络</option>
                        <option value="media">传媒</option>
                        <option value="pool">人才库</option>
                        <option value="former_employees">离职员工</option>
                        <option value="employee_referral">员工推荐</option>
                        <option value="executive_search">猎头</option>
                        <option value="campus_recruitment">校园招聘</option>
                        <option value="job">职介</option>
                        <option value="other">其他</option>
                    </select>
				</div>
				<div class="clearfix"></div>
			</div>
			<div class="form-action clearfix">
				<button class="button" type="button" onclick="javascript:checkForm()"><s:if test="#request.operation == 'add'"> 添加</s:if><s:else>修改</s:else></button>
				<button class="button" type="reset">重置</button>
				<a class="button" href="javascript:void(0)" onclick="history.back()"><span
					style="background: url(${ctx}/images/img/arrow_undo.png)" class="icon">&nbsp;</span>返回</a>
			</div>
		</form>
	</div>
</div>

<div class="clear"></div>
<script type="text/javascript">

    $(document).ready(function(){
        <s:if test="#request.inviteFashion == null">
            $("#channel option").eq(0).attr('selected', 'true');
        </s:if>
        <s:else>
            $("#channel option[value='${inviteFashion.channel}']").attr("selected","true") ;
        </s:else>
    });

	function checkForm(){
		if($("#channel").val().length ==0 ){
			alert('请输入渠道名称');
			return false;
		}
        var url = "${ctx}/invite/post_fashion.xhtml";
        $.ajax(url, {
            type:"POST",
            data:$("#post_form").serialize(),
            dataType:"html",
            cache:false,
            success:function (a) {
//                if (confirm('还要继续添加吗？')) {
//                	$("#channel").val("");
//                }else{
                	location.href = "${ctx}/index.xhtml#invite/invite_list.xhtml?p=invite_arrange";
//                }
            },
            error:function(XMLHttpRequest, textStatus, errorThrown){
            	alert('提交申请发生异常');
            },
            complete:function () {
            }
        });
	}
</script>
